package com.mdlib.helper.ui.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ljlib.help.R;
import com.mdlib.helper.model.entity.RunEntity;
import com.mdlib.helper.utils.GlideCircleTransform;

import java.util.List;

/**
 * 作者：HQY on 16/11/14 17:47
 * 邮箱：hqy_xz@126.com
 */

public class VicinityRunAdapter extends BaseQuickAdapter<RunEntity> {


    public VicinityRunAdapter(List<RunEntity> data) {
        super(R.layout.item_vicinity_run, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, RunEntity runEntity) {
        baseViewHolder.setText(R.id.tv_send_run_name, runEntity.getRealName())
                .setText(R.id.tv_send_run_distance, runEntity.getDistance() + "km")
                .setRating(R.id.rb_send_run_level, Float.valueOf(runEntity.getPingScore()), 5);

        Glide.with(mContext)
                .load(runEntity.getImgPath())
                .placeholder(R.drawable.iv_app_default_head)
                .error(R.drawable.iv_app_default_head)
                .transform(new GlideCircleTransform(mContext))
                .into((ImageView) baseViewHolder.getView(R.id.iv_vicinity_head));


    }
}
